from .rag_without_vecdb import do_answer_question as do_answer_question1
from .rag_with_vecdb import do_answer_question as do_answer_question2
from .weather_mcp_host import get_jzg_tomorrow_weather
from .restaurant_mcp_host import get_restaurants


async def chat_with_agent(user_msg: str):
    print(f"Received user message: '{user_msg}'")

    if "经纬度" in user_msg:
        call_func = get_restaurants
    elif "九寨沟" not in user_msg:
        call_func = do_answer_question1
    elif "天气" in user_msg:
        call_func = get_jzg_tomorrow_weather
    else:
        call_func = do_answer_question2

    agent_reply = await call_func(user_msg)
    yield ('TEXT', f"{agent_reply}")
